package com.dhr.tx.service.impl;

import com.dhr.tx.bean.UserPo;
import com.dhr.tx.orm.UserMapper;
import org.springframework.aop.framework.AopContext;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @description:
 * @className: UserServiceImplNoInf
 * @package: com.dhr.tx.service.impl
 * @author: duanhr@hsyuntai.com
 * @date: 2019/3/8 15:54
 * @copyright: 版权归 HSYUNTAI 所有
 */
@Service("userServiceImplNoInf")
public class UserServiceImplNoInf {
    @Autowired
    private UserMapper userMapper;

    @Transactional
    public    void methodA(UserPo userPo) {
        this.tx(userPo);
    }

    public void methodB(UserPo userPo) {
        this.methodA(userPo);
    }

    private void tx(UserPo userPo) {
        System.out.println("old userPo:" + userPo.toString());
        Integer insertCount = userMapper.restInsert(userPo);
        System.out.println("old userPo insert result:" + insertCount);
        Integer updateCount = userMapper.restUpdate(new UserPo(userPo.getUserId(), null,12));
        System.out.println("old userPo update result:" + updateCount);
        System.out.println(1 / 0);
    }
}
